#include <iostream>
#include <unistd.h>
#include <cstdio>
#include <string>
#include <pthread.h>

// 验证pthread_creat()传参

class Task
{
public:
    Task(int a, int b) : _a(a), _b(b) {}
    int Exe()
    {
        return _a + _b;
    }
    ~Task() {}

private:
    int _a;
    int _b;
};

class Run
{
public:
    Run(int ret) : _ret(ret) {}
    int Getret()
    {
        return _ret;
    }
    ~Run() {}

private:
    int _ret;
};

void* routine(void* args)
{
    Task *tmp = static_cast<Task*>(args);
    Run r(tmp->Exe());

    std::cout<<r.Getret()<<std::endl;

    return nullptr;
}

int main()
{
    pthread_t tid;
    Task t(10,20);
    int n = pthread_create(&tid, nullptr, routine, (void*)&t);

    pthread_join(tid, nullptr);
    return 0;
}